<?php 
include 'common.php';
//$errors[] = null;
if(isset($_POST['submit'])){
	$valid =true;
	if(empty($_POST['username'])){
		$valid =false;
		$errors[] = $lang['ERROR_USERNAME'];
	}
	if(empty($_POST['password'])){
		$valid =false;
		$errors[] = $lang['ERROR_PASSWORD'];
	}
	if($valid==true){
		$username = mysql_real_escape_string($_POST['username']); 
		$password = mysql_real_escape_string($_POST['password']);
		$Qlogin = "SELECT * from user where username = '$username' and password=PASSWORD('$password')";
		$check= $db->sql_total($Qlogin);
		$result = $db->sql_list($Qlogin);
		
		if($check <> 0){
					$_SESSION['islogin'] = "yes";
					$_SESSION['username'] = $result['username'];
					$_SESSION['userlogin_id'] = $result['id'];
					$_SESSION['email']   = $result['email'];
					$_SESSION['name']   = $result['name'];
					$_SESSION['notel']   = $result['notel'];
					if($result['no_ahli'] != '' && $result['verify_ahli']=='verified'){
						$_SESSION['isAhli']   = "yes";
					}
					
					header( 'Location: index.php' ) ;
					
		}else{
			$fail=true;
		}
	
	}

}
																	
include_once('functions.php');																	
include 'template_left.php';
//include 'home.php';
include 'login_content.php';
include 'footer.php';



?>